import type { ApartmentItem, PageParams, PageResult } from '/@/types/global'
// import type { BannerItem, CategoryItem, HouseItem, HotItem } from '/@/types/home'
import type { BannerItem, HouseItem,ApartmentInfo } from '/@/types/home'
import { http } from '@/utils/http'

/**
 * 首页-广告区域-小程序
 * @param distributionSite 广告区域展示位置（投放位置 投放位置，1为首页，2为分类商品页） 默认是1
 */

export const getHomeBannerAPI = () => {
    return http<BannerItem[]>({
        method: 'POST',
        url: '/app/banner/info/list',
    })
}

/**
 * 推荐房屋列表
 */
export const getHomehouseRecommendListAPI = (data?: PageParams) => {
    return http<PageResult<ApartmentItem>>({
        method: 'POST',
        url: '/app/house/page',
        data,
    })
}

// 首页两格推荐-房屋
export const getHomeTwoaAPI = (orderBy: string) => {
    return http<PageResult<ApartmentItem>>({
        method: 'POST',
        url: '/app/house/page',
        data: {
            pageNum: 1,
            pageSize: 2,
            orderBy,
        },
    })
}

export const getApartmentInfo = (id: number) => {
    return http<ApartmentInfo>({
        method: 'GET',
        url: `/app/apartment/${id}`,
    })
}